package com.wlyuan.open.infrastructure.converter;

import com.wlyuan.core.domain.MappingIds;
import com.wlyuan.core.marker.MappingStatus;
import com.wlyuan.open.dao.entity.OpenApiLogDO;
import com.wlyuan.open.domain.api.OpenApiLog;
import com.wlyuan.open.domain.api.utils.MappingOpenApiLog;
import org.mapstruct.InheritInverseConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

/**
 * @author yuanzheng
 */
public class OpenApiLogConverter {
    @Mapper(uses = {
            MappingIds.class,
            MappingStatus.class,
            MappingOpenApiLog.class
    })
    public interface Converter {
        OpenApiLog convert(OpenApiLogDO source);

        @InheritInverseConfiguration
        OpenApiLogDO convert(OpenApiLog source);
    }

    private static final Converter CONVERTER = Mappers.getMapper(Converter.class);

    public static OpenApiLogDO convert(OpenApiLog source) {
        return CONVERTER.convert(source);
    }

    public static OpenApiLog convert(OpenApiLogDO source) {
        return CONVERTER.convert(source);
    }
}
